from collections import Iterable

# 迭代


a_dict = {'a': 1, 'b': 2}
for key in a_dict:
    print(key, end=' ')
print()

for value in a_dict.values():
    print("value: ", value)

for k, v in a_dict.items():
    print(k, ": ", v)

for ch in 'ABC':
    print(ch)

print(isinstance('abc', Iterable))
print(isinstance(123, Iterable))

# 带索引的迭代
for i, v in enumerate("ABC"):
    print(i + 1, ": ", v)
